{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}

{{#if view.stackVersionError}}
  <div class="alert alert-warning" role="alert">
    <div class="stack-error-row">
      <div class="image-container">
        <i class="glyphicon glyphicon-warning-sign"></i>
      </div>
      <div class="message-container">
        <h4 class="display-inline">{{view.stackVersionError.title}}</h4>
        <span class="stack-name">{{view.stackVersionError.stack}}</span>
        <div>
          {{view.stackVersionError.description}}
        </div>
      </div>
      {{#havePermissions "AMBARI.MANAGE_STACK_VERSIONS"}}
        <div class="btn-container">
          <button class="btn btn-warning" {{action reinstallOutOfSyncComponents view.stackVersionError target="controller"}}>
            {{t common.reinstall}}
          </button>
          <button class="btn btn-warning" {{action removeOutOfSyncComponents view.stackVersionError target="controller"}}>
            {{t common.remove}}
          </button>
        </div>
      {{/havePermissions}}
    </div>
  </div>
{{/if}}

<div id="versions-filter-section" class="btn-toolbar">
  {{#havePermissions "AMBARI.MANAGE_STACK_VERSIONS"}}
    <button class="btn btn-primary" {{action goToVersions target="view"}}  {{bindAttr disabled="App.router.wizardWatcherController.isNonWizardUser"}} id="manage-versions-link">
        <i class="icon-external-link"></i>&nbsp;{{t admin.stackVersions.manageVersions}}
    </button>
  {{/havePermissions}}
  <div class="btn-group display-inline-block">
    <button class="btn btn-default dropdown-toggle" data-bs-toggle="dropdown" href="#">
      <span class="filters-label">{{t common.filter}}: </span>
        <span>
          {{view.selectedCategory.label}}
          <span class="caret"></span>
        </span>
    </button>
    <ul class="dropdown-menu">
      {{#each category in view.categories}}
        <li>
          <a {{action selectCategory category target="view"}} href="#">
            {{category.label}}
          </a>
        </li>
      {{/each}}
    </ul>
  </div>
</div>
<div id="versions-section" class="row col-md-12">
  <div {{bindAttr class=":col-md-2 :version-column :left-menu-table view.hasSpecialTypeRepoVersion:has-special-type-repo-version"}}>
    {{#each service in view.services}}
      <div class="service-cell-wrapper">
        <div class="service-cell service-version-info">
          <span class="service-label">{{service.displayName}}</span>
        </div>
      </div>
    {{/each}}
    <div class="service-cell-wrapper">
      <div class="service-cell">
      </div>
    </div>
  </div>
  <div class="col-md-10 versions-slides">
    {{#if isLoaded}}
      <div class="versions-slides-bar">
        {{#each version in view.repoVersions}}
          {{#if version.isVisible}}
            {{view App.UpgradeVersionColumnView contentBinding="version" displayVersionTypeBlockBinding="view.hasSpecialTypeRepoVersion"}}
          {{/if}}
        {{/each}}
      </div>
    {{else}}
      {{view App.SpinnerView}}
    {{/if}}
  </div>
</div>
